<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>捐赠物品登记详情</title>
    <#include "/common/resource.ftl">
    <script type="text/javascript">
        $(function () {
            <#if (params.id)??>
                $.ajaxRequest({
                    url: '${params.contextPath}/web/donation/query.json',
                    data: {id: "${params.id}"},
                    success: function (data) {
                        if (!data.success) {
                            $.message(data.message);
                            return;
                        }
                        var record = data.data;
                        for (var key in record) {
                            $("[field='" + key + "']").html(record[key]);
                        }

                        if (record.donationItemList) {
                            var donationItemList = record.donationItemList, strs = "";
                            for (var i = 0; i < donationItemList.length; i ++) {
                                var item = donationItemList[i];
                                item.index = i;
                                var str =  '<tr>\
                                <td>{name}</td>\
                                <td>{quantity}</td>\
                                <td>{evaluate}</td>\
                                </tr>';
                                str = str.format(item);
                                strs += str;
                            }
                            $("#good-table tbody").html(strs);
                        }
                    }
                });
            </#if>
        });
    </script>
    <style>
        .layui-card-header{font-weight:bold;}
        .layui-table th{background-color:#f2f2f2 !important;width:120px;}
    </style>
</head>
<body style="background:#eee;">
<div style="padding:10px;">
    <div class="layui-card">
        <div class="layui-card-header">基本信息</div>
        <div class="layui-card-body">
            <table class="layui-table" lay-size1="sm">
                <tr>
                    <th>捐赠人</th>
                    <td field="name">--</td>
                    <th>日期</th>
                    <td field="happenDateStr">--</td>
                </tr>
                <tr>
                    <th>类型</th>
                    <td field="typeStr">--</td>
                    <th>捐赠意愿</th>
                    <td field="intention">--</td>
                </tr>
                <tr>
                    <th>金额</th>
                    <td field="amount">--</td>
                    <th>处置意见</th>
                    <td field="handle">--</td>
                </tr>
                <tr>
                    <th>经办人</th>
                    <td field="handleName">--</td>
                    <th>备注</th>
                    <td field="remark">--</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-header">物品信息</div>
        <div class="layui-card-body">
            <table class="layui-table" lay-size="sm" id="good-table">
                <thead>
                <tr>
                    <th>物品名称</th>
                    <th>数量</th>
                    <th>估价</th>
                </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
    </div>
</div>
</body>

</html>
